import { http } from '@/utils/request'

// 用户相关API
export const userAPI = {
  // 获取用户信息
  getUserInfo: () => http.get('/user/profile'),
  
  // 更新用户信息
  updateUserInfo: (data) => http.put('/user/profile', data),
  
  // 上传头像
  uploadAvatar: (formData) => {
    return http.post('/user/avatar', formData, {
      headers: {
        'Content-Type': 'multipart/form-data'
      }
    })
  },
  
  // 获取用户案件列表
  getUserCases: (params) => http.get('/user/cases', params),
  
  // 获取用户消息列表
  getUserMessages: (params) => http.get('/user/messages', params),
  
  // 标记消息为已读
  markMessageRead: (messageId) => http.patch(`/user/messages/${messageId}/read`),
  
  // 删除消息
  deleteMessage: (messageId) => http.delete(`/user/messages/${messageId}`),
  
  // 获取用户通知设置
  getNotificationSettings: () => http.get('/user/notification-settings'),
  
  // 更新用户通知设置
  updateNotificationSettings: (data) => http.put('/user/notification-settings', data),
  
  // 获取用户收藏的法律资源
  getFavorites: (params) => http.get('/user/favorites', params),
  
  // 添加收藏
  addFavorite: (data) => http.post('/user/favorites', data),
  
  // 取消收藏
  removeFavorite: (id) => http.delete(`/user/favorites/${id}`)
} 